home *** CD-ROM | disk | FTP | other *** search
- //sky vertex shader:
- //moves texture coordinates with time
-
- //Luke Lenhart
- //(C)2004-2005 Digipen Institute of Technology
-
- //world,view,projection transform
- float4x4 matWorldViewProj;
-
- //current time (in seconds) since whenever
- float curTime;
-
- //alpha amount of layer
- float alpha;
-
- //scale level of texture sampling
- float scale;
-
- //shader input
- struct VS_INPUT
- {
- float4 Pos : POSITION;
- float4 Color : COLOR;
- float2 Tex0 : TEXCOORD0;
- };
-
- //shader output
- struct VS_OUTPUT
- {
- float4 Pos : POSITION;
- float4 Color : COLOR;
- float2 Tex0 : TEXCOORD0;
- };
-
- //shader code
- VS_OUTPUT VShader(VS_INPUT In)
- {
- VS_OUTPUT Out;
-
- //calc transformed position
- Out.Pos=mul(matWorldViewProj,In.Pos);
-
- //adjust texture coordinate
- Out.Tex0=scale*(In.Tex0+curTime*float2(0.03f,0.0013f));
-
- //copy color through
- Out.Color=In.Color;
- Out.Color.a*=alpha;
-
- //spit out the results
- return Out;
- }
-